
import MySQLdb
import json
from tornado.options import define, options
import unicodedata

define("mysql_host", default="127.0.0.1", help="football database host")
define("mysql_database", default="livescore", help="football database name")
define("mysql_user", default="root", help="football database user")
define("mysql_password", default="", help="football database password")

def getConnection():
	return MySQLdb.connect(options.mysql_host, options.mysql_user,options.mysql_password, options.mysql_database,charset = "utf8", use_unicode = True)

def _process_unicode(u):
    if type(u) is unicode:    
        return  unicodedata.normalize('NFKD', u).encode('ascii', 'ignore')
    else:
        return u
